program myweibull_lf
	version 8.1
	args lnf leta lgam
	tempvar p M R
	quietly {
		gen double `p' = exp(`lgam')
		gen double `M' = ($ML_y1*exp(-`leta'))^`p'
		gen double `R' = ln($ML_y1)-`leta'
		replace `lnf' = -`M' + $ML_y2*(`lgam'-`leta'+(`p'-1)*`R')
	}
end
